import { ArrToObject } from "@/utils/utils";

export const WEEKS = [
  {
    label: "周一",
    value: "week1",
  },
  {
    label: "周二",
    value: "week2",
  },
  {
    label: "周三",
    value: "week3",
  },
  {
    label: "周四",
    value: "week4",
  },
  {
    label: "周五",
    value: "week5",
  },
  {
    label: "周六",
    value: "week6",
  },
  {
    label: "周日",
    value: "week7",
  },
];

export function concatWeekAndDate(weeks, times) {
  const weekMap = ArrToObject(WEEKS);
  let result = [];
  let str = "";
  Object.keys(weeks).forEach((key) => {
    if (key.indexOf("week") > -1 && weeks[key] == 2) {
      result.push(weekMap[key]);
    }
  });
  str += result.join("，");
  str += " ";
  result = [];
  times.forEach((time) => {
    result.push(`${time.startTime}~${time.endTime}`);
  });
  str += result.join("，");
  return str;
}
